home *** CD-ROM | disk | FTP | other *** search
/ Family Forum 262 / SOMC Family Forum 262.iso / Xtras / Behavior Library.cst / 00026_Media Preload.ls < prev    next >
Encoding:
Text File  |  1997-11-17  |  6.4 KB  |  163 lines

  1. -- Media Preload 
  2.  
  3.  
  4. -- behavior library version 1.1
  5.  
  6. -- on prepareframe or mouseup
  7. -- load frames, members, a movie, or all frames and members, 
  8. -- if not ready, goes to the current frame - allows animated cursor or other behaviors to
  9. -- happen
  10.  
  11. property tracking   -- 0 haven't started, 1 in progress, 2 done
  12. property whichEvent
  13.  
  14. property allmembers
  15. property framerange
  16. property StartFrame
  17. property EndFrame
  18. property memberrange
  19. property StartMember
  20. property EndMember
  21. property amovie
  22. property moviename
  23. property preloadID
  24. property netaware
  25.  
  26. property gettingall       -- 0 if not started, 1 if started, 2 if finished
  27. property gettingframes
  28. property gettingmembers
  29. property gettingmovie 
  30. -- will loop on the current frame while preloading is happening
  31.  
  32. on beginsprite me
  33.   set gettingall = 0
  34.   set gettingframes = 0
  35.   set gettingmembers = 0
  36.   set gettingmovie = 0
  37. end
  38.  
  39. on init me
  40.   if tracking <> 2 then set tracking = TRUE
  41.   do_it
  42. end  
  43.  
  44. on do_it me
  45.   if tracking then
  46.     if (allmembers = TRUE and gettingall <> 2 ) and        (framerange= TRUE and gettingframes <> 2 ) and        (memberrange= TRUE and gettingmembers <> 2 ) and        (amovie = TRUE and gettingmovie <> 2 ) then
  47.       
  48.       if netaware then
  49.         if allmembers then
  50.           if not frameready() then go the frame
  51.           if gettingall = 0 then
  52.             set gettingall = 1
  53.             preload
  54.             set gettingall = 2
  55.           end if
  56.         end if
  57.         
  58.         if framerange then
  59.           if not frameready (startframe, endframe) then go the frame
  60.           if gettingframes = 0 then
  61.             set gettingframes = 1
  62.             preload startframe, endframe
  63.             set gettingframes = 2
  64.           end if
  65.         end if
  66.         
  67.         if memberrange then
  68.           if not mediaready (startMember, endMember) then go the frame
  69.           if gettingmembers = 0 then
  70.             set gettingmembers = 1
  71.             preloadMember startMember, endMember
  72.             set gettingmembers = 2
  73.           end if        
  74.         end if
  75.         
  76.         if amovie then
  77.           if gettingmovie = 0 then
  78.             set preloadID = preloadnetthing (moviename)  -- ask Chris about this part
  79.             set gettingmovie = 1
  80.           end if
  81.           
  82.           if not netDone(preloadID) then go the frame  --netdoneID
  83.           
  84.           preLoadMovie moviename
  85.           set gettingmovie = 2
  86.           
  87.         end if
  88.       else -- end netaware
  89.         if allmembers then    
  90.           if gettingall = 0 then
  91.             set gettingall = 1
  92.             preload
  93.             set gettingall = 2
  94.           end if
  95.         end if
  96.         
  97.         if framerange then
  98.           if gettingframes = 0 then
  99.             set gettingframes = 1
  100.             preload startframe, endframe
  101.             set gettingframes = 2
  102.           end if
  103.         end if
  104.         
  105.         if memberrange then
  106.           if gettingmembers = 0 then
  107.             set gettingmembers = 1
  108.             preloadMember startMember, endMember
  109.             set gettingmembers = 2
  110.           end if        
  111.         end if
  112.         
  113.         if amovie then
  114.           if gettingmovie = 0 then
  115.             set gettingmovie = 1        
  116.             preLoadMovie moviename
  117.             set gettingmovie = 2          
  118.           end if
  119.         end if 
  120.         
  121.       end if -- end not netaware   
  122.       
  123.     else -- check for everything done
  124.       set tracking = 2
  125.     end if
  126.     
  127.   end if  -- end tracking
  128.   
  129. end
  130.  
  131.  
  132. on initPreLoad me
  133.   init me
  134. end
  135.  
  136. on mouseUp me
  137.   if whichEvent = #mouseup    then init me
  138. end
  139.  
  140. on prepareFrame me
  141.   if whichEvent = #prepareframe then init me
  142. end
  143.  
  144.  
  145.  
  146. ---
  147.  
  148. on getPropertyDescriptionList
  149.   
  150.   set p_list = [     #whichEvent: [ #comment:   "Initializing Event:",                     #format:   #symbol,                      #range: [ #MouseUp, #MouseDown, #PrepareFrame,#EnterFrame, #ExitFrame],                    #default:   #MouseUp ],     #allmembers: [ #comment:  "All Members:",                     #format:   #boolean,                    #default:    0 ],    #framerange:  [ #comment:   "Frame Range:",                     #format:   #boolean,                    #default:    0 ],     #StartFrame: [ #comment:   "Start Frame:",                     #format:   #integer,                    #default:   0 ],       #EndFrame: [ #comment:   "End Frame:",                     #format:   #integer,                    #default:   0 ],  #memberrange:   [ #comment:   "Member Range:",                     #format:   #boolean,                    #default:    0 ],     #StartMember: [ #comment:   "Start Member:",                     #format:   #member,                    #default:   member 1 ],       #EndMember: [ #comment:   "End Member:",                     #format:   #member,                    #default:   member 1 ],         #amovie: [ #comment:   "Preload Movie:",                     #format:   #boolean,                    #default:    0 ],      #moviename: [ #comment:   "Movie Name:",                     #format:   #string,                    #default:   "" ],       #netaware: [ #comment:   "Internet Aware:",                     #format:   #boolean,                    #default:    0 ]   ]
  151.   return p_list  
  152.   
  153. end
  154.  
  155. on getBehaviorDescription
  156.   set x = "Loads cast members into RAM so they are instantly available to the movie. Define what to preload by specifying a range of cast members in a cast or frames in the score. The behavior can also load all the cast members in a different movie. If the Internet Aware parameter is turned on, the behavior checks the network cache to make sure the media is on the local disk before it is loaded into RAM.  "& RETURN & "PARAMETERS:" & RETURN & "ΓÇó Initializing Event - Specify the event that triggers the behavior." & RETURN & "ΓÇó All Members - Choose this option to load all cast members in the current movie starting at the current frame."  & RETURN & "ΓÇó Frame Range - Turn this option on and define a range of frames to load. Enter the start and end frames of the range in the appropriate boxes." 
  157.   
  158.   set x = x &  RETURN & "ΓÇó Member Range  - Turn this option on and define a range of cast members within a cast. Choose the first and last cast members to load from the pop-ups."  & RETURN & "ΓÇó Preload Movie - Turn this option on and enter the name of a Director movie in Movie Name. All the cast members in the movie are loaded. Use this parameter to reduce delays when switching to a different movie." & RETURN & "ΓÇó Internet Aware - Turn this option on to make Director check the network cache to make sure the media is on the local disk before preloading." 
  159.   
  160.   return x
  161.   
  162. end
  163.